package com.eastfair.questionnaire.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.eastfair.core.base.entity.Entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.eastfair.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;
import com.eastfair.annotation.model.EchoVO;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 问题
 * </p>
 *
 * @author yuwx
 * @since 2021-09-04
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("q_question")
@ApiModel(value = "Question", description = "问题")
@AllArgsConstructor
public class Question extends Entity<Long> implements EchoVO {

    private static final long serialVersionUID = 1L;
    @TableField(exist = false)
    private Map<String, Object> echoMap = new HashMap<>();
    /**
     * 项目ID
     */
    @ApiModelProperty(value = "项目ID")
    @TableField(value = "project_id")
    @Excel(name = "项目ID")
    private Long projectId;

    /**
     * 展会名
     */
    @ApiModelProperty(value = "问卷ID")
    @TableField(value = "questionnaire_id")
    @Excel(name = "问卷ID")
    private Long questionnaireId;

    /**
     * 下一题
     */
    @ApiModelProperty(value = "下一题")
    @TableField(value = "next_question_id")
    @Excel(name = "下一题")
    private Long nextQuestionId;

    /**
     * 题型
     */
    @ApiModelProperty(value = "题型")
    @Size(max = 20, message = "题型长度不能超过20")
    @TableField(value = "question_type", condition = LIKE)
    @Excel(name = "题型")
    private String questionType;

    /**
     * 排序
     */
    @ApiModelProperty(value = "排序")
    @TableField(value = "sequence")
    @Excel(name = "排序")
    private Integer sequence;

    /**
     * 问题名称
     */
    @ApiModelProperty(value = "问题名称")
    @Size(max = 128, message = "问题名称长度不能超过128")
    @TableField(value = "name", condition = LIKE)
    @Excel(name = "问题名称")
    private String name;

    /**
     * 问题英文名称
     */
    @ApiModelProperty(value = "问题英文名称")
    @Size(max = 128, message = "问题英文名称长度不能超过128")
    @TableField(value = "en_name", condition = LIKE)
    @Excel(name = "问题英文名称")
    private String enName;

    /**
     * 问题别名
     */
    @ApiModelProperty(value = "问题别名")
    @Size(max = 128, message = "问题别名长度不能超过128")
    @TableField(value = "alias_name", condition = LIKE)
    @Excel(name = "问题别名")
    private String aliasName;

    /**
     * 问题英文别名
     */
    @ApiModelProperty(value = "问题英文别名")
    @Size(max = 128, message = "问题英文别名长度不能超过128")
    @TableField(value = "en_alias_name", condition = LIKE)
    @Excel(name = "问题英文别名")
    private String enAliasName;

    /**
     * 问题描述
     */
    @ApiModelProperty(value = "问题描述")
    @Size(max = 128, message = "问题描述长度不能超过128")
    @TableField(value = "description", condition = LIKE)
    @Excel(name = "问题描述")
    private String description;

    /**
     * 必填
     */
    @ApiModelProperty(value = "必填")
    @TableField(value = "is_required")
    @Excel(name = "必填")
    private Integer isRequired;

    /**
     * 选择答案数量下限
     */
    @ApiModelProperty(value = "选择答案数量下限")
    @TableField(value = "select_lower")
    @Excel(name = "选择答案数量下限")
    private Integer selectLower;

    /**
     * 选择答案数量上限
     */
    @ApiModelProperty(value = "选择答案数量上限")
    @TableField(value = "select_upper")
    @Excel(name = "选择答案数量上限")
    private Integer selectUpper;

    /**
     * 是否生效(默认1：可用 0:不可用)
     */
    @ApiModelProperty(value = "是否生效(默认1：可用 0:不可用)")
    @TableField(value = "is_enable")
    @Excel(name = "是否生效(默认1：可用 0:不可用)")
    private Integer isEnable;

    /**
     * 是否删除(默认0：未删除 1:已删除)
     */
    @ApiModelProperty(value = "是否删除(默认0：未删除 1:已删除)")
    @TableField(value = "is_delete")
    @Excel(name = "是否删除(默认0：未删除 1:已删除)")
    private Integer isDelete;


    @Builder
    public Question(Long id, Long createdBy, LocalDateTime createTime, Long updatedBy, LocalDateTime updateTime, 
                    Long projectId, Long questionnaireId, Long nextQuestionId, String questionType, Integer sequence, 
                    String name, String enName, String aliasName, String enAliasName, String description, Integer isRequired, 
                    Integer selectLower, Integer selectUpper, Integer isEnable, Integer isDelete) {
        this.id = id;
        this.createdBy = createdBy;
        this.createTime = createTime;
        this.updatedBy = updatedBy;
        this.updateTime = updateTime;
        this.projectId = projectId;
        this.questionnaireId = questionnaireId;
        this.nextQuestionId = nextQuestionId;
        this.questionType = questionType;
        this.sequence = sequence;
        this.name = name;
        this.enName = enName;
        this.aliasName = aliasName;
        this.enAliasName = enAliasName;
        this.description = description;
        this.isRequired = isRequired;
        this.selectLower = selectLower;
        this.selectUpper = selectUpper;
        this.isEnable = isEnable;
        this.isDelete = isDelete;
    }

}
